<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户注册</title>
    <style>
        /* 保持与登录页面一致的风格 */
        body {
            background: #f0f2f5;
            font-family: 'Segoe UI', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }

        .register-container {
            background: white;
            padding: 2.5rem;
            border-radius: 12px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.1);
            width: 380px;
            transition: transform 0.3s ease;
        }

        .register-container:hover {
            transform: translateY(-5px);
        }

        .register-title {
            font-size: 28px;
            color: #1a1a1a;
            margin-bottom: 2rem;
            text-align: center;
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        .form-group {
            margin-bottom: 1.5rem;
            position: relative;
        }

        .form-group label {
            display: block;
            color: #4a4a4a;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 500;
        }

        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 12px;
            border: 2px solid #e3e3e3;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.3s ease;
        }

        input:focus {
            border-color: #0066ff;
            outline: none;
            box-shadow: 0 0 0 3px rgba(0,102,255,0.1);
        }

        .captcha-group {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .captcha-img {
            border: 2px solid #e3e3e3;
            border-radius: 6px;
            padding: 5px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .captcha-img:hover {
            border-color: #0066ff;
            transform: scale(1.05);
        }

        .register-button {
            width: 100%;
            padding: 14px;
            background: #0066ff;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .register-button:hover {
            background: #0052cc;
            box-shadow: 0 5px 15px rgba(0,102,255,0.3);
        }

        .login-link {
            text-align: center;
            margin-top: 1.5rem;
            color: #666;
            font-size: 14px;
        }

        .login-link a {
            color: #0066ff;
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .login-link a:hover {
            color: #0047b3;
        }

        /* 错误提示样式 */
        .error-message {
            background: #ffe6e6;
            color: #ff4444;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 1.5rem;
            border: 1px solid #ffcccc;
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="register-container">
    <h1 class="register-title">创建账号</h1>

    <c:if test="${not empty registerError}">
        <div class="error-message">${registerError}</div>
    </c:if>

    <form action="${pageContext.request.contextPath}/register" method="post">
        <div class="form-group">
            <label>用户名</label>
            <input type="text" name="username" placeholder="请输入用户名" required>
        </div>

        <div class="form-group">
            <label>密码</label>
            <input type="password" name="password" placeholder="请输入密码" required>
        </div>

        <div class="form-group">
            <label>验证码</label>
            <div class="captcha-group">
                <input type="text" name="code" placeholder="输入验证码" required>
                <img src="${pageContext.request.contextPath}/code"
                     class="captcha-img"
                     onclick="this.src='${pageContext.request.contextPath}/code?t='+Math.random()"
                     title="点击刷新验证码">
            </div>
        </div>

        <button type="submit" class="register-button">立即注册</button>
    </form>

    <div class="login-link">
        已有账号？<a href="${pageContext.request.contextPath}/login">立即登录</a>
    </div>
</div>
</body>
</html>-